﻿; (function (window, undefined, $) {
    var submiting = false;
    $('#frmEdit').validator({
        rules: {

        },
        fields: {
            '#FundName': 'required',
            '#FundCompany': 'required',
            '#FundContent': 'required',
            '#RunPeople': 'required',
            '#CreateTime': 'required',
            '#Grade': 'required',
            '#Riskcue': 'required'
        },
        valid: function (form) {
            if (submiting) {
                return;
            }
            submiting = true;
            FormSubmit(form, function(res) {
                if (res.status > 0) {
                    alert(res.message);
                    window.location.href = "/Admin/Fund/PrivatelyFundList";
                } else {
                    alert(res.message);
                }
                submiting = false;
            });
        }
    });

    $("#btnSave").click(function (e) {
        $("#hideContent").val($("#FundContent").val());
        $("#hideAppContent").val($("#AppContent").val());
        $("#frmEdit").submit();
    });
    
    $("#btnReturn").click(function (e) {
        window.location.href = "/Admin/Fund/PrivatelyFundList";
    });
})(window, undefined, jQuery);